Imports System
Imports ValidationFramework
Imports ValidationFramework.Reflection

Namespace NewRule
    Public Class RequiredCharacterRuleAttribute
        Inherits RuleAttribute
        Implements IRuleAttribute
        ' Methods
  
        ''' <param name="requiredCharacter">The required character.</param>
        Public Sub New(ByVal requiredCharacter As Char)
            _requiredCharacter = requiredCharacter
        End Sub

        Public Overrides Function CreateRule(ByVal infoDescriptor As InfoDescriptor) As Rule
            Return New RequiredCharacterRule(MyBase.ErrorMessage,  _
                                             MyBase.UseErrorMessageProvider, _requiredCharacter)
        End Function


        ' Properties
        ''' <summary>
        ''' Gets the required character.
        ''' </summary>
        Public ReadOnly Property RequiredCharacter() As Char
            Get
                Return _requiredCharacter
            End Get
        End Property


        ' Fields
        Private ReadOnly _requiredCharacter As Char
    End Class
End Namespace